using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Tools;
using Pixysoft.Framework.Verifications;
using Pixysoft.Framework.Noebe;
using Pixysoft.Weblications.Sango.Entities;

namespace Pixysoft.Weblications.Sango.Environment
{
    public class SysProfessionalHelper
    {
        private static List<Sys_Professional> orms = new List<Sys_Professional>();

        public static void initialize()
        {
            orms = SettingHelper.GetNoebe().EntityNoebeCommand.Select<Sys_Professional>();

            LoggerHelper.Info("initialize Sys_Professional.countin {0}", orms.Count);
        }

        public static List<Sys_Professional> searchAll()
        {
            return orms;
        }

        public static Sys_Professional searchByCode(long serialcode)
        {
            foreach (Sys_Professional orm in orms)
            {
                if (orm.Professionalserialcode != serialcode)
                    continue;

                return orm;
            }

            throw Exceptions.VerificationFailedException(serialcode);
        }

    }
}